From 7d1419db19cec3a1ff19290345b5d90f5c7ec399 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 20 Mar 2015 20:23:53 -0700 Subject: [PATCH] Update tests for tweaked error messages --- tests/test_cargo_build_lib.rs | 5 ++--- tests/test_cargo_compile.rs | 10 ++++------ tests/test_cargo_compile_custom_build.rs | 4 ++-- tests/test_cargo_test.rs | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/test_cargo_build_lib.rs b/tests/test_cargo_build_lib.rs index 97320184a..e26f09033 100644 --- a/tests/test_cargo_build_lib.rs +++ b/tests/test_cargo_build_lib.rs @@ -51,7 +51,6 @@ test!(build_with_no_lib { "#); assert_that(p.cargo_process("build").arg("--lib"), - execs() - .with_status(101) - .with_stderr("There is no lib to build, remove `--lib` flag")); + execs().with_status(101) + .with_stderr("no library targets found")); }); diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 1a1b41e30..70029f0a2 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -5,7 +5,7 @@ use tempdir::TempDir; use support::{project, execs, main_file, basic_bin_manifest}; use support::{COMPILING, RUNNING, ProjectBuilder}; -use hamcrest::{assert_that, existing_file}; +use hamcrest::{assert_that, existing_file, is_not}; use support::paths::CargoPathExt; use cargo::util::process; @@ -1349,9 +1349,7 @@ test!(dep_no_libs { "#) .file("bar/src/main.rs", ""); assert_that(foo.cargo_process("build"), - execs().with_status(101) - .with_stderr("\ -Package `bar v0.0.0 ([..])` has no library targets")); + execs().with_status(0)); }); test!(recompile_space_in_name { @@ -1552,14 +1550,14 @@ test!(example_bin_same_name { .exec_with_output() .unwrap(); - assert_that(&p.bin("foo"), existing_file()); + assert_that(&p.bin("foo"), is_not(existing_file())); assert_that(&p.bin("examples/foo"), existing_file()); p.cargo("test").arg("--no-run").arg("-v") .exec_with_output() .unwrap(); - assert_that(&p.bin("foo"), existing_file()); + assert_that(&p.bin("foo"), is_not(existing_file())); assert_that(&p.bin("examples/foo"), existing_file()); }); diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index 20b4557ef..3bea9644b 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -91,7 +91,7 @@ test!(custom_build_env_vars { assert_eq!(opt, "0"); let opt = env::var("PROFILE").unwrap(); - assert_eq!(opt, "compile"); + assert_eq!(opt, "debug"); let debug = env::var("DEBUG").unwrap(); assert_eq!(debug, "true"); @@ -1176,7 +1176,7 @@ test!(profile_and_opt_level_set_correctly { fn main() { assert_eq!(env::var("OPT_LEVEL").unwrap(), "3"); - assert_eq!(env::var("PROFILE").unwrap(), "bench"); + assert_eq!(env::var("PROFILE").unwrap(), "release"); assert_eq!(env::var("DEBUG").unwrap(), "false"); } "#); diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index d8b5fe28c..fb8a43b55 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -91,7 +91,7 @@ test!(many_similar_names { #[test] fn test_test() { foo::foo() } "#); - let output = p.cargo_process("test").exec_with_output().unwrap(); + let output = p.cargo_process("test").arg("-v").exec_with_output().unwrap(); let output = str::from_utf8(&output.stdout).unwrap(); assert!(output.contains("test bin_test"), "bin_test missing\n{}", output); assert!(output.contains("test lib_test"), "lib_test missing\n{}", output); -- 2.30.2